// [2425]-所有数对的异或和
struct Solution;

//leetcode submit region begin(Prohibit modification and deletion)
impl Solution {
    pub fn xor_all_nums(nums1: Vec<i32>, nums2: Vec<i32>) -> i32 {
        // 偶-偶
        if nums1.len() % 2 == 0 && nums2.len() % 2 == 0 { return 0 };

        let mut ans = 0;
        if nums1.len() % 2 == 0 { // 奇-偶
            for x in nums1 {
                ans ^= x;
            };
        } else if nums2.len() % 2 == 0 { // 奇-偶
            for x in nums2 {
                ans ^= x;
            };
        } else { // 奇-奇
            for x in nums1 {
                ans ^= x;
            };
            for x in nums2 {
                ans ^= x;
            };
        };
        ans
    }
}
//leetcode submit region end(Prohibit modification and deletion)

///总结：对于队列组合要考虑所有情况

#[test]
fn main() {
    let nums1 = vec![2,1,3];
    let nums2 = vec![10,2,5,0];
    assert_eq!(Solution::xor_all_nums(nums1, nums2), 13);
    let nums1 = vec![1,2];
    let nums2 = vec![3,4];
    assert_eq!(Solution::xor_all_nums(nums1, nums2), 0);
    let nums1 = vec![8,6,29,2,26,16,15,29];
    let nums2 = vec![24,12,12];
    assert_eq!(Solution::xor_all_nums(nums1, nums2), 9);
}